﻿using Daily.Application.DTO;
using DailyApp.Application.DTO.WaitInfo;
using DailyApp.WPF.Models;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace DailyApp.WPF.ViewModels
{
    public class HomeUCViewModel : BindableBase, INavigationAware
    {
        public HomeUCViewModel()
        {
            CreateStatPanelList();
            CreateWaitInfoList();
            CreateMemoInfoList();
            //CloseWindowCommand = new DelegateCommand(Close);
        }
        #region 实现方法
        private void CreateStatPanelList()
        {
            statPanelList = new List<StatPanelInfo>();
            StatPanelList.Add(new StatPanelInfo { Icon = "ClockFast", ItemName = "汇总", BackColor = "#0ba0fd", ViewName = "waituc", Result = "9" });
            StatPanelList.Add(new StatPanelInfo { Icon = "ClockCheckOutline", ItemName = "已完成", BackColor = "#1dca37", ViewName = "waituc", Result = "32" });
            StatPanelList.Add(new StatPanelInfo { Icon = "ChartLineVariant", ItemName = "完成比例", BackColor = "#00c7dc", Result = "90%" });
            StatPanelList.Add(new StatPanelInfo { Icon = "PlaylistStar", ItemName = "备忘求", BackColor = "#FFFFA000", ViewName = "MemoUc", Result = "9" });
        }
        private void CreateWaitInfoList()
        {
            WaitInfoList = new List<WaitInfoDTO>();
            WaitInfoList.Add(new WaitInfoDTO() { Title = "测试录屏", Content = "仔细给客户演示测试" });
            WaitInfoList.Add(new WaitInfoDTO() { Title = "上传录屏", Content = "上传录屏，上传时，仔细检査是否有效果录屏等"});
        }
        private void CreateMemoInfoList()
        {
            MemoInfoList = new List<MemoInfoDTO>();
            MemoInfoList.Add(new MemoInfoDTO() { Title = "会议一", Content = "会议会议内容，讨论并确立项目需求" });
            MemoInfoList.Add(new MemoInfoDTO() { Title = "会议二", Content = "所有项目干系人都要参与，会议内容，讨论并确立项计划" });
        }

        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
        {
            //throw new NotImplementedException();
        }
        /// <summary>
        /// 接收导航数据
        /// </summary>
        /// <param name="navigationContext"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (navigationContext.Parameters.ContainsKey("UserName")) {
                var dateTime= DateTime.Now.ToString("yyyy-MM-dd dddd", new System.Globalization.CultureInfo("zh-CN"));
                var UserName=navigationContext.Parameters.GetValue<string>("UserName");
                HomeTile = $"你好,{UserName}!今天是{dateTime}";
            }
        }

        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return true;
        }

        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
        }

        #endregion

        #region 定义方法
        public DelegateCommand MaxCommand { get; set; }

        #endregion

        #region 属性
        private List<StatPanelInfo> statPanelList;

        public List<StatPanelInfo> StatPanelList
        {
            get { return statPanelList; }
            set { statPanelList = value; RaisePropertyChanged(); }
        }

        private List<WaitInfoDTO> waitInfoList;

        public List<WaitInfoDTO> WaitInfoList
        {
            get { return waitInfoList; }
            set { waitInfoList = value;RaisePropertyChanged(); }
        }

        private List<MemoInfoDTO> memoInfoList;

        public List<MemoInfoDTO> MemoInfoList
        {
            get { return memoInfoList; }
            set { memoInfoList = value; RaisePropertyChanged(); }
        }

        private string homeTile;

        public string HomeTile
        {
            get { return homeTile; }
            set { homeTile = value; }
        }

        #endregion


    }
}
